﻿
@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<style>
    .form .formValue input.form-control {
        height: 34px;
        line-height: 34px;
    }

    .selectbox {
        color: #444;
        line-height: 34px;
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        height: 34px;
        width: 100%;
    }

    .form-control {
        padding: 0px;
    }

    .autocomplete-suggestions {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        border: 1px solid #999;
        background: #FFF;
        cursor: default;
        overflow: auto;
        -webkit-box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64);
        -moz-box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64);
        box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64);
    }

    .autocomplete-selected {
        background: #F0F0F0;
    }

    .autocomplete-suggestion {
        padding: 2px 5px;
        white-space: nowrap;
        overflow: hidden;
    }

    .autocomplete-no-suggestion {
        padding: 2px 5px;
    }

    ul {
        list-style: none;
        float: left;
        -webkit-padding-start: 10px;
    }

        ul li {
            list-style-type: none;
            float: left;
        }

    .active {
        border: 1px solid #1ABC9C;
    }

        .active:hover {
            background-color: #1ABC9C;
            color: #fff;
            text-decoration: none;
        }

    a {
        padding: 3px 10px;
    }

        a:hover {
            border: 1px solid #1ABC9C;
            text-decoration: none;
        }

    .selectbox {
        color: #444;
        line-height: 34px;
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        height: 34px;
        width: 100%;
    }
</style>

<div id="companyInfos">
    <form id="companyForm">
        <table class="form">
            <tr>
                <td colspan="6">
                    <table class="form">

                        @*<tr>
                                <td colspan="6" class="interval">需求信息</td>
                            </tr>*@
                        <tr>
                            <td colspan="6">
                                <table class="form">
                                    <tr>
                                        <td class="formTitle">关联空间<span style="color:red;font-weight:bold;font-size:14px;">*</span></td>
                                        <td class="formValue">
                                            <select id="F_Class111" name="spaces" class="form-control required">
                                                <option value="">==请选择关联空间==</option>
                                            </select>
                                        </td>
                                        <td class="formTitle">资讯类型</td>
                                        <td class="formValue">
                                            <select id="F_Types" name="articleTypes" class="form-control required select2"></select>
                                        </td>
                                        <td class="formTitle">所属栏目</td>
                                        <td class="formValue">
                                            <select id="banners" name="" class="form-control required select2"></select>
                                        </td>

                                    </tr>
                                    <tr>
                                        <td class="formTitle">资讯来源</td>
                                        <td class="formValue">
                                            <select id="F_Source" name="" class="form-control select2-container select2-container--default select2-container--open">
                                                <option value="">==请选择资讯来源==</option>
                                            </select>
                                        </td>
                                        <td class="formTitle">资讯标题</td>
                                        <td class="formValue">
                                            <input type="text" id="F_Title" name="" class="form-control" placeholder="资讯标题" />
                                        </td>

                                    </tr>

                                    <tr>
                                        <td class="formTitle">摘要</td>
                                        <td class="formValue" colspan="5">
                                            <textarea rows="3" id="F_Abstract" name="F_Note" class="form-control" placeholder="摘要" style="width:99%;"></textarea>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="formTitle">资讯首图地址</td>
                                        <td class="formValue">
                                            <input type="file" id="F_FirstPicture" name="" class="" placeholder="资讯首图地址" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="formTitle">资讯显示时间<span style="color:red;font-weight:bold;font-size:14px;">*</span></td>
                                        <td class="formValue">
                                            <input type="text" id="F_Time" name="F_ActivityEndDate" class="form-control input-wdatepicker required" onfocus="WdatePicker()" placeholder="资讯显示时间" />
                                        </td>
                                        <td class="formTitle">是否首页推荐<span style="color:red;font-weight:bold;font-size:14px;">*</span></td>
                                        <td class="formValue">
                                            <input type="checkbox" id="F_HomeRecommenda" name="F_BuildDate" class=" " onfocus="" placeholder="是否首页推荐" />
                                        </td>
                                        <td class="formTitle">首页推荐时间<span style="color:red;font-weight:bold;font-size:14px;">*</span></td>
                                        <td class="formValue">
                                            <input type="text" id="F_HomeRecTime" name="F_ActivityEndDate" class="form-control input-wdatepicker required" onfocus="WdatePicker()" placeholder="首页推荐时间" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="formTitle">浏览次数</td>
                                        <td class="formValue">
                                            <input type="number" id="F_Viewed" name="F_BuildDate" class="form-control" placeholder="浏览次数" />
                                        </td>
                                        <td class="formTitle">点赞次数</td>
                                        <td class="formValue">
                                            <input type="number" id="F_UpNumber" name="F_PersionNumber" class="form-control number" placeholder="点赞次数" />
                                        </td>
                                        <td class="formTitle">搜索关键字</td>
                                        <td class="formValue">
                                            <input type="text" id="key" name="F_SiteArea" class="form-control number" placeholder="搜索关键字" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="formTitle">审核状态</td>
                                        <td class="formValue">
                                            <select id="F_State" name="auditStates" class="form-control select2-container select2-container--default select2-container--open">
                                                <option value="">==请选择审核状态==</option>
                                            </select>
                                        </td>
                                        <td class="formTitle">是否热门推荐</td>
                                        <td class="formValue">
                                            <input type="checkbox" id="F_Hot" name="F_PersionNumber" class="" placeholder="是否热门推荐" value="1" />
                                        </td>
                                        <td class="formTitle">热门推荐时间</td>
                                        <td class="formValue">
                                            <input type="text" id="F_HotRecTime" name="F_ActivityEndDate" class="form-control input-wdatepicker required" onfocus="WdatePicker()" placeholder="热门推荐时间" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="formTitle">推荐城市</td>
                                        <td class="formValue">
                                            <select id="F_RecCity" name="F_ActivityType" class="form-control select2-container select2-container--default select2-container--open select2">
                                                <option value="">==请选择推荐城市==</option>
                                            </select>
                                        </td>
                                        <td class="formTitle">是否专题</td>
                                        <td class="formValue">
                                            <input type="checkbox" id="F_IsSpecial" name="" class="required" placeholder="是否专题" value="1" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="formTitle">资讯内容</td>
                                        <td class="formValue" colspan="5">
                                            <textarea rows="3" id="F_Details" name="F_Note" class="form-control" placeholder="" style="width:99%;"></textarea>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>

                    </table>
                </td>
            </tr>
        </table>
    </form>
</div>


@section Content{
    <script>
        $(function () {

            $("#F_Class111").html('<option value="111">11</option>').select2();
        });
    </script>
}


@*<script>
        var dictionaryData;
        var workFlowId = $.request("keyValue");
        var mark = $.request("mark");

        $(function () {
            initData();



            //$("#F_Class").bindSelect({
            //    url: "/ClientManager/ClientInfos/GetAllCitys",
            //    search: true,
            //    id: "F_EnCode",
            //    text: "F_FullName"
            //});

        });

        //初始化控件
        function initControl() {

            if (mark == 'detail') {
                $('.form-control').prop('disabled', true);
            }

            $("#banners").bindSelect({
                placeholder: "请选择相关内容",
                multiple: true
            });


            //var $multipleSelectControls = $("#F_Class, #F_Types, #banners, #F_Source,#F_State,#F_RecCity");

            //$multipleSelectControls.bindSelect({
            //    placeholder: "请选择相关内容",
            //    //multiple: true
            //});

            //var spaces = dictionaryData.spaces;
            //for (var i = 0; i < spaces.length; i++) {
            //    $("#F_Class").append("<option value='" + spaces[i].Key + "'>" + spaces[i].Value + "</option>");
            //}

            //var articleTypes = dictionaryData.articleTypes;
            //for (var i = 0; i < articleTypes.length; i++) {
            //    $("#articleTypes").append("<option value='" + articleTypes[i].F_Id + "'>" + articleTypes[i].F_ItemName + "</option>");
            //}
            $("#F_Types").bindSelect({
                url: "/Topic/Article/GetIndexArticleTypesTreeSelectJson",
            });

            var banners = dictionaryData.banners;
            for (var i = 0; i < banners.length; i++) {
                $("#banners").append("<option value='" + banners[i].F_ItemCode + "'>" + banners[i].F_ItemName + "</option>");
            }

            var sources = dictionaryData.sources;
            for (var i = 0; i < sources.length; i++) {
                $("#F_Source").append("<option value='" + sources[i].F_ItemCode + "'>" + sources[i].F_ItemName + "</option>");
            }

            var auditStates = dictionaryData.auditStates;
            for (var i = 0; i < auditStates.length; i++) {
                $("#F_State").append("<option value='" + auditStates[i].F_ItemCode + "'>" + auditStates[i].F_ItemName + "</option>");
            }

            $("#F_RecCity").bindSelect({
                url: "/ClientManager/ClientInfos/GetAllCitys",
                search: true,
                id: "F_EnCode",
                text: "F_FullName"
            });



            //$("#F_Class").select2({ multiple: false });

            //$("#F_Class").on("select2:select", function () {
            //    //var data = $(this).val();
            //    //callback && callback(data);
            //});
        }

        //初始化字典数据
        function initDictionryData() {
            $.ajax({
                url: "/Topic/Article/GetIndexItemsJson",
                dataType: "json",
                async: false,
                success: function (data) {
                    dictionaryData = data;
                }
            });
        }

        //初始化数据
        function initData() {
            initDictionryData();
            initControl();

            if (mark == 'add') {
                return;
            }

            //$.ajax({
            //    url: "/Topic/Article/SubmitForm?keyValue=" + workFlowId,
            //    dataType: "json",
            //    async: false,
            //    success: function (data) {
            //        //$("#F_Types").val(data.F_Types);
            //        //$("#F_Class").val(data.F_Class);
            //        //$("#F_Source").val(data.F_Source);
            //        //$("#F_Title").val(data.F_Title);
            //        //$("#F_Class").val(data.F_Class);
            //        //$("#F_Class").val(data.F_Class);
            //        //$("#F_Class").val(data.F_Class);
            //        //$("#F_Class").val(data.F_Class);
            //        //$("#F_Class").val(data.F_Class);
            //    }
            //});
        }

        //提交表单
        function submitForm() {

            //if (!$('#form1').formValid()) {
            //    return false;
            //}

            //var $workFormId = $('#F_WorkFormId').val();

            //if ($workFormId == null || $workFormId == '' || $workFormId.indexOf('请选择') >= 0) {
            //    $.modalAlert("请选中流程表单！", "warning");
            //    return false;
            //}

            $.submitForm({
                url: "/Topic/Article/SubmitForm?keyValue=" + '',
                param: {
                    'F_Types': $('#F_Types').val(),
                    'F_Class': $('#F_Class').val(),
                    'F_Source': $('#F_Source').val(),
                    'F_Title': $('#F_Title').val(),
                    'F_Abstract': $('#F_Abstract').val(),
                    'F_FirstPicture': $('#F_FirstPicture').val(),
                    'F_Time': $('#F_Time').val(),
                    'F_HomeRecommenda': $('#F_HomeRecommenda').val(),
                    'F_HomeRecTime': $('#F_HomeRecTime').val(),
                    'F_Viewed': $('#F_Viewed').val(),
                    'F_UpNumber': $('#F_UpNumber').val(),
                    'F_State': $('#F_State').val(),
                    'F_Hot': $('#F_Hot').val(),
                    'F_HotRecTime': $('#F_HotRecTime').val(),
                    'F_Details': $('#F_Details').val(),
                    'F_RecCity': $('#F_RecCity').val(),
                    'F_IsSpecial': $('#F_IsSpecial').val(),
                },
                success: function (result) {
                    $.currentWindow().$("#gridList").trigger("reloadGrid");
                }
            });

            return true;
        }
    </script>*@